<div class="account-nav-warp" id="nav-warp">
  <div class="account-nav-title">
    <span>
      {% case routes.current_route %}
      {% when 'account/profilechange' %}
      {{lang.account.default.profile | upcase }}
      {% when 'account/orders' %}
      {{lang.account.default.orders | upcase }}
      {% when 'account/addresses' %}
      {{lang.account.default.address | upcase }}
      {% when 'account/changepassword' %}
      {{lang.account.default.change_password | upcase }}
      {% endcase %}
    </span>
    <span class="account-edge"></span>
  </div>
  <ul class="account-nav-list">
    {% if routes.current_route != "account/profilechange" %}
    <li class="account-nav-item">
      <a href="/account/profilechange">{{lang.account.default.profile | upcase }}</a>
    </li>
    {% endif %}
    {% if routes.current_route != "account/orders" %}
    <li class="account-nav-item">
      <a href="{{routes.account_orders_url}}">{{lang.account.default.orders | upcase }}</a>
    </li>
    {% endif %}
    {% if routes.current_route != "account/addresses" %}

    <li class="account-nav-item">
      <a href="{{routes.account_addresses_url}}">{{lang.account.default.address | upcase }}</a>
    </li>
    {% endif %}
    {% if routes.current_route != "account/changepassword" %}

    <li class="account-nav-item">
      <a href="{{routes.account_changepassword_url}}">{{lang.account.default.change_password | upcase }}</a>
    </li>
    {% endif %}
    <li class="account-nav-item">
      <a href="javascript:;" id="out">{{lang.account.default.sing_out}}</a>
    </li>
  </ul>
</div>
<script>
const navWarp = $("#nav-warp");
    const navWarpTitle = navWarp.children(".account-nav-title")[0];
    const navWarpUl = navWarp.children(".account-nav-list")[0];
    function switchClass(self,classsname){
        self.hasClass(classsname) ? self.removeClass(classsname) : self.addClass(classsname);
    }
    $(navWarpTitle).click(function () {
        switchClass($(this),"account-nav-title-active")
        $(navWarpUl).slideToggle();
    });
    $(function(){
       $("#out").click(function () {
            const self = this;
            moi.confirm({
                title: '{{lang.account.default.sing_out_tips}}',
                ok: function () {
                    location.href = '/account/logout';
                }
            })

        });
    })
   
</script>